<template>
    <table>
        <thead>
            <tr>
                <th style="width: 120px">汇编符号</th>
                <th style="width: 300px">功能</th>
                <th style="width: 200px">机器码</th>
                <th>备注</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in content">
                <td>{{ item[0] }}</td>
                <td>{{ item[1] }}</td>
                <td>{{ item[2] }}</td>
                <td>{{ item[3] }}</td>
            </tr>
        </tbody>
    </table>
</template>

<script setup>
const content = [
    // ['汇编符号', '功能', '机器码', '备注'],
    ['MOVA  R1, R2', '(R2)→R1', '0100 R1 R2', ''],
    ['MOVB  M, R2', '(R2)→(R0) ', '0101 00 R2', ''],
    ['MOVC  R1, M', '((R0))→R1', '0110 R1 00', ''],
    ['MOVD  R3, PC', '(PC)→R3', '0111 11 XX', ''],
    ['ADD  R1, R2', '(R1)+(R2)→R1', '1000 R1 R2', ''],
    [
        'SUB  R1, R2',
        '(R1)-(R2)→R1, IF(R1>R2), THEN G=1, ELSE G=0 ',
        '1001 R1 R2',
        '',
    ],
    ['JMP', '(R3)→PC', '1010 XX 11', ''],
    ['JG', 'IF G=1, THEN (R3)→PC ', '1011 XX 11', ''],
    ['IN  R1', '将常数赋给R1', '1100 R1 XX', ''],
    ['OUT  R2', '将R2的值输出', '1101 XX R2 ', ''],
    ['MOVI IMM', '立即数IMM    (R0)', '1110 00 XX IMM', '2 字节'],
    ['HALT', '停机', '1111 00 00 ', ''],
]
</script>

<style scoped>
table {
    border-collapse: collapse;
    width: 800px;
    margin: 0 auto;
}

td,
th {
    border: 1px solid #000;
    padding: 8px;
}
</style>
